package com.zhongyou.bean.invoice.vo;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 电子发票-销售明细实体类（Entity）
 * @author Apollo
 *
 */
public class DetailItem implements Serializable {
	private static final long serialVersionUID = 1L;
	//Fields
	private String rmsNo;//RMS中类编号
	private String taxItem;//商品税目
	private String code = "";//税务编码
	private String name = "";//货物或应税劳务、服务名称(税务名称)
	private String taxName = "";//税务分类简称
	private String model;//规格型号
	private String unit = "";//单位
	private BigDecimal quantity = new BigDecimal(0.00D);//数量
	private BigDecimal price = new BigDecimal(0.00D);//未税单价（不含税单价）
	private BigDecimal amount = new BigDecimal(0.00D);//未税金额（不含税金额）
	private BigDecimal taxRate = new BigDecimal(0.00D);//税率
	private BigDecimal taxAmount = new BigDecimal(0.00D);//税额（上缴税局的金额）
	private BigDecimal sumAmount = new BigDecimal(0.00D);//合计金额：未税金额 + 税额
	
	//折扣项
	private BigDecimal discAmt = new BigDecimal(0.00D);//折扣金额（不含税）
	private BigDecimal discTaxAmt = new BigDecimal(0.00D);//折扣税额（上缴税局的金额）
	//setters & getters
	public String getRmsNo() {
		return rmsNo;
	}
	public void setRmsNo(String rmsNo) {
		this.rmsNo = rmsNo;
	}
	public String getTaxItem() {
		return taxItem;
	}
	public void setTaxItem(String taxItem) {
		this.taxItem = taxItem;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getModel() {
		return model;
	}
	public void setModel(String model) {
		this.model = model;
	}
	public String getUnit() {
		return unit;
	}
	public void setUnit(String unit) {
		this.unit = unit;
	}
	public BigDecimal getQuantity() {
		return quantity;
	}
	public void setQuantity(BigDecimal quantity) {
		this.quantity = quantity;
	}
	public BigDecimal getPrice() {
		return price;
	}
	public void setPrice(BigDecimal price) {
		this.price = price;
	}
	public BigDecimal getAmount() {
		return amount;
	}
	public void setAmount(BigDecimal amount) {
		this.amount = amount;
	}
	public BigDecimal getTaxRate() {
		return taxRate;
	}
	public void setTaxRate(BigDecimal taxRate) {
		this.taxRate = taxRate;
	}
	public BigDecimal getTaxAmount() {
		return taxAmount;
	}
	public void setTaxAmount(BigDecimal taxAmount) {
		this.taxAmount = taxAmount;
	}
	public BigDecimal getSumAmount() {
		return sumAmount;
	}
	public void setSumAmount(BigDecimal sumAmount) {
		this.sumAmount = sumAmount;
	}
	
	
	public BigDecimal getDiscAmt() {
		return discAmt;
	}
	public void setDiscAmt(BigDecimal discAmt) {
		this.discAmt = discAmt;
	}
	public BigDecimal getDiscTaxAmt() {
		return discTaxAmt;
	}
	public void setDiscTaxAmt(BigDecimal discTaxAmt) {
		this.discTaxAmt = discTaxAmt;
	}
	public String getTaxName() {
		return taxName;
	}
	public void setTaxName(String taxName) {
		this.taxName = taxName;
	}
	//Constructors
	public DetailItem() {
		super();
	}
	public DetailItem(String rmsNo, String taxItem, String code, String name,
                      String model, String unit, BigDecimal quantity, BigDecimal price,
                      BigDecimal amount, BigDecimal taxRate, BigDecimal taxAmount,
                      BigDecimal sumAmount, String taxName) {
		super();
		this.rmsNo = rmsNo;
		this.taxItem = taxItem;
		this.code = code;
		this.name = name;
		this.model = model;
		this.unit = unit;
		this.quantity = quantity;
		this.price = price;
		this.amount = amount;
		this.taxRate = taxRate;
		this.taxAmount = taxAmount;
		this.sumAmount = sumAmount;
		this.taxName = taxName;
	}
	@Override
	public int hashCode() {
		int hash = 3;
		hash *= rmsNo.hashCode();
		hash *= unit.hashCode();
		return hash * quantity.intValue() + price.intValue() * taxRate.intValue();
	}

	@Override
	public boolean equals(Object obj) {
		if(obj == null)
			return false;
		if(this == obj)
			return true;
		if(obj instanceof DetailItem) {
			DetailItem di = (DetailItem) obj;
			if(!rmsNo.equals(di.getRmsNo()) || !unit.equals(di.getUnit()))
				return false;
			if(quantity.equals(di.getQuantity()) && 
					price.equals(di.getPrice()) && 
					taxRate.equals(di.getTaxRate())) 
				return true;
		}
		return false;
	}
	@Override
	public String toString() {
		return "DetailItem [rmsNo=" + rmsNo + ", taxItem=" + taxItem
				+ ", code=" + code + ", name=" + name + ", model=" + model
				+ ", unit=" + unit + ", quantity=" + quantity + ", price="
				+ price + ", amount=" + amount + ", taxRate=" + taxRate
				+ ", taxAmount=" + taxAmount + ", sumAmount=" + sumAmount +", taxName=" + taxName +  "]";
	}

	
}